package com.google.ads;

import android.app.Activity;
import android.os.SystemClock;
import android.view.View;
import com.google.ads.b.r;
import com.google.ads.b.w;
import com.google.ads.b.x;
import com.google.ads.util.ac;
import com.google.ads.util.b;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;

public class ad
{
  private final r a;
  private ak b = null;
  private Object c = new Object();
  private Thread d = null;
  private Object e = new Object();
  private boolean f = false;
  private Object g = new Object();

  protected ad()
  {
    this.a = null;
  }

  public ad(r paramr)
  {
    b.a(paramr);
    this.a = paramr;
  }

  public static boolean a(aa paramaa, r paramr)
  {
    if (paramaa.j() == null)
      return true;
    if (paramr.g().b())
    {
      if (!paramaa.j().a())
      {
        com.google.ads.util.d.e("InterstitialAd received a mediation response corresponding to a non-interstitial ad. Make sure you specify 'interstitial' as the ad-type in the mediation UI.");
        return false;
      }
      return true;
    }
    g localg1 = ((x)paramr.g().k.a()).b();
    if (paramaa.j().a())
    {
      com.google.ads.util.d.e("AdView received a mediation response corresponding to an interstitial ad. Make sure you specify the banner ad size corresponding to the AdSize you used in your AdView  (" + localg1 + ") in the ad-type field in the mediation UI.");
      return false;
    }
    g localg2 = paramaa.j().b();
    if (localg2 != localg1)
    {
      com.google.ads.util.d.e("Mediation server returned ad size: '" + localg2 + "', while the AdView was created with ad size: '" + localg1 + "'. Using the ad-size passed to the AdView on creation.");
      return false;
    }
    return true;
  }

  private boolean a(String paramString, Activity paramActivity, d paramd, ah paramah, HashMap paramHashMap, long paramLong)
  {
    synchronized (new ak(this, (x)this.a.g().k.a(), paramah, paramString, paramd, paramHashMap))
    {
      ???.a(paramActivity);
      try
      {
        while ((!???.b()) && (paramLong > 0L))
        {
          long l1 = SystemClock.elapsedRealtime();
          ???.wait(paramLong);
          long l2 = SystemClock.elapsedRealtime();
          paramLong -= l2 - l1;
        }
      }
      catch (InterruptedException localInterruptedException)
      {
        com.google.ads.util.d.a("Interrupted while waiting for ad network to load ad using adapter class: " + paramString);
        this.a.l().a(???.d());
        if ((???.b()) && (???.c()))
        {
          if (this.a.g().b());
          for (View localView = null; ; localView = ???.e())
          {
            this.a.a(new ag(this, ???, localView, paramah));
            return true;
          }
        }
        ???.a();
        return false;
      }
    }
  }

  private void b(aa paramaa, d paramd)
  {
    label242: 
    do
    {
      long l;
      HashMap localHashMap;
      ah localah;
      String str4;
      Activity localActivity;
      do
      {
        while (true)
        {
          synchronized (this.e)
          {
            b.a(Thread.currentThread(), this.d);
            List localList1 = paramaa.f();
            if (paramaa.a())
            {
              l = paramaa.b();
              Iterator localIterator1 = localList1.iterator();
              if (!localIterator1.hasNext())
                break label292;
              k localk = (k)localIterator1.next();
              com.google.ads.util.d.a("Looking to fetch ads from network: " + localk.b());
              List localList2 = localk.c();
              localHashMap = localk.e();
              localList3 = localk.d();
              String str1 = localk.a();
              String str2 = localk.b();
              String str3 = paramaa.c();
              if (localList3 == null)
                break label242;
              localah = new ah(str1, str2, str3, localList3, paramaa.h(), paramaa.i());
              Iterator localIterator2 = localList2.iterator();
              if (!localIterator2.hasNext())
                continue;
              str4 = (String)localIterator2.next();
              localActivity = (Activity)this.a.g().e.a();
              if (localActivity != null)
                break;
              com.google.ads.util.d.a("Activity is null while mediating.  Terminating mediation thread.");
              return;
            }
          }
          l = 10000L;
          continue;
          List localList3 = paramaa.g();
        }
        this.a.l().c();
      }
      while (a(str4, localActivity, paramd, localah, localHashMap, l));
    }
    while (!b());
    com.google.ads.util.d.a("GWController.destroy() called. Terminating mediation thread.");
    return;
    label292: this.a.a(new af(this, paramaa));
  }

  private boolean b()
  {
    synchronized (this.g)
    {
      boolean bool = this.f;
      return bool;
    }
  }

  private boolean b(ak paramak)
  {
    synchronized (this.g)
    {
      if (b())
      {
        paramak.a();
        return true;
      }
      return false;
    }
  }

  public void a(aa paramaa, d paramd)
  {
    synchronized (this.e)
    {
      if (a())
      {
        com.google.ads.util.d.c("Mediation thread is not done executing previous mediation  request. Ignoring new mediation request");
        return;
      }
      a(paramaa, this.a);
      this.d = new Thread(new ae(this, paramaa, paramd));
      this.d.start();
      return;
    }
  }

  public void a(ak paramak)
  {
    synchronized (this.c)
    {
      if (this.b != paramak)
      {
        if (this.b != null)
          this.b.a();
        this.b = paramak;
      }
      return;
    }
  }

  public boolean a()
  {
    while (true)
    {
      synchronized (this.e)
      {
        if (this.d != null)
        {
          bool = true;
          return bool;
        }
      }
      boolean bool = false;
    }
  }
}

/* Location:           D:\Studium\Bachelorarbeit\BA Marcus Wobig\BA\BA\Decompiler\PicturePassword APK\Programm\PicturePassword_dex2jar.jar
 * Qualified Name:     com.google.ads.ad
 * JD-Core Version:    0.6.2
 */